from __future__ import print_function # 通过导入 __future__ 包来兼容 Python3.x print
import datetime

now = datetime.datetime.now()
print(now) #  打印当前时间 2025-06-04 01:26:13.356925

year = now.strftime("%Y")
print("year:", year) # year: 2025

month = now.strftime("%m")
print("month:", month) # month: 06

month = now.strftime("%m")
print("month:", month) # month: 06

day = now.strftime("%d")
print("day:", day) # day: 04

time = now.strftime("%H:%M:%S")
print("time:", time) # time: 01:26:13

date_time = now.strftime("%Y-%m-%d, %H:%M:%S")
print("date and time:",date_time) # date and time: 2025-06-04, 01:26:13